#include<iostream>
#include<string>
#include<cmath>
using namespace std;
typedef long long LL;
LL ans = 1e15;
string s;

void fun(char c)
{
	int idx = 0;
	LL sum = 0;
	for (int i = 0; i < s.size(); i++) {
		if (s[i] == c) {
			sum += abs(idx - i);
			idx += 2;
		}
	}
	ans = min(ans, sum);
}
int main()
{
	cin >> s;
	int cnt_0 = 0, cnt_1 = 0;
	for (int i = 0; i < s.size(); i++) {
		if (s[i] == '0')cnt_0++;
		else cnt_1++;
	}
	if (cnt_1 >= cnt_0)fun('1');
	if (cnt_0 <= cnt_1)fun('0');
	cout << ans << endl;
	return 0;
}